//
//  NSObject+Additions.m
//  OrderSeat
//
//  Created by 王威 on 13-12-15.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "NSObject+Additions.h"

@implementation NSObject (Additions)

- (BOOL)isNullOrEmpty
{
    if(self == NULL || self == nil) return YES;
    if ([self isKindOfClass:[NSDictionary class]] || [self isKindOfClass:[NSMutableDictionary class]]) {
        NSDictionary *dic = (NSDictionary *)self;
        return [dic allKeys].count == 0;
    }
    else if ([self isKindOfClass:[NSArray class]] || [self isKindOfClass:[NSMutableArray class]]) {
        NSArray *arr = (NSArray *)self;
        return arr.count == 0;
    }
    else if ([self isKindOfClass:[NSString class]]) {
        NSString *str = (NSString *)self;
        if ([str isEqualToString:@""] || [str length] == 0) {
            return YES;
        }
    }
    
    return NO;
}

@end
